package com.mvc.core.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import javax.servlet.http.HttpServletRequest;

import com.mvc.core.handler.HandlerMapping;

public class ProxyFactory {

	private HandlerMapping handlerMapping;

	private Object traget;

	public Object getProxy() {
		Object proxy = Proxy.newProxyInstance(traget.getClass().getClassLoader(), traget.getClass().getInterfaces(),
				new InvocationHandler() {
					@Override
					public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
						Object retVal = method.invoke(traget, args);
						return retVal;
					}
				});
		return proxy;
	}



	public HandlerMapping getHandlerMapping() {
		return handlerMapping;
	}


	public void setHandlerMapping(HandlerMapping handlerMapping) {
		this.handlerMapping = handlerMapping;
	}







	public Object getTraget() {
		return traget;
	}

	public void setTraget(Object traget) {
		this.traget = traget;
	}

}
